package com.aivin.lib_reader;


public class ReaderConfig {

    /**
     * 正文文字大小
     */
    private int mTextSize;

    /**
     * 正文的边界
     */
    private int[] mPadding;

    /**
     * 电池宽度和高度
     */
    private int[] mBatteryWidthAndHeight;

    /**
     * 正文行间距
     */
    private int mLineSpace;



    private ReaderConfig() {
    }

    private ReaderConfig(ReaderConfig config) {
        this.mBatteryWidthAndHeight = config.mBatteryWidthAndHeight;
        this.mLineSpace = config.mLineSpace;
        this.mPadding = config.mPadding;
        this.mTextSize = config.mTextSize;
    }

    public static ReaderConfig newInstance(ReaderConfig config) {
        return new ReaderConfig(config);
    }

    public int getTextSize() {
        return mTextSize;
    }

    public void setTextSize(int textSize) {
        mTextSize = textSize;
    }

    public int[] getPadding() {
        return mPadding;
    }

    public int getLineSpace() {
        return mLineSpace;
    }
    public void setLineSpace(int lineSpace) {
        mLineSpace = lineSpace;
    }


    public static class Builder {
        private int[] mPadding = {40, 70, 40, 70};
        private int[] mBatteryWidthAndHeight = new int[]{60, 30};

        void apply(ReaderConfig readerConfig) {
            // 默认值
            readerConfig.mTextSize =60;
            readerConfig.mPadding = this.mPadding;
            readerConfig.mLineSpace = 10;
            readerConfig.mBatteryWidthAndHeight = this.mBatteryWidthAndHeight;
        }

        public ReaderConfig build() {
            ReaderConfig readerConfig = new ReaderConfig();
            apply(readerConfig);
            return readerConfig;
        }

    }
}
